package com.slz3.business.module.configManagement.conZone.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conZone.domain.ConZone;
import com.slz3.business.module.configManagement.conZone.domain.ConZoneFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConZoneTransactionalServiceImpl implements ConZoneTransactionalService {

    @Override
    public ConZone modify(ConZone conZoneNew) {
        Repositorys.conZone.test();
        Repositorys.conZone.save(ConZoneFactory.initBaseFields());
        System.err.println(1/0);
        conZoneNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conZone.saveAndFlush(conZoneNew);
    }

    @Override
    public List<ConZone> batchModify(List<ConZone> conZoneList) {
        return Repositorys.conZone.saveAll(conZoneList);
    }
}
